import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import java.awt.GridBagLayout;
import javax.swing.JLabel;
import java.awt.GridBagConstraints;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import java.awt.Font;
import javax.swing.JButton;
import javax.swing.LayoutStyle.ComponentPlacement;
import java.awt.Color;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.SwingConstants;
import javax.swing.UIManager;


public class MainMenu extends JFrame {

	Schedule sched;
	Accounts acct;
	PayRoll pr;
	Inventory inv;
	AddUser au;
	GPS gps;
	Billing bill;
	Requests rqst;
	LogIn li;
	
	
	private JPanel contentPane;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					MainMenu frame = new MainMenu();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public MainMenu() {
		setForeground(new Color(50, 205, 50));
		setTitle("Main Menu\r\n");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 800,500);
		contentPane = new JPanel();
		contentPane.setForeground(new Color(255, 255, 255));
		contentPane.setBackground(new Color(0, 128, 0));
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		
		JLabel lblMainMenu = new JLabel("Main Menu");
		lblMainMenu.setForeground(new Color(0, 0, 128));
		lblMainMenu.setFont(new Font("Eras Medium ITC", Font.PLAIN, 35));
		
		JButton btnLogOut = new JButton("Log Out");
		btnLogOut.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				
				li = new LogIn();
				setVisible(false);
				li.setVisible(true);
			}
		});
		
		JLabel label = new JLabel("");
		
		
		
		JButton btnSchedule = new JButton("Schedule");
		btnSchedule.setFont(new Font("Tahoma", Font.PLAIN, 16));
		btnSchedule.setBackground(UIManager.getColor("Button.light"));
		btnSchedule.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				
				sched = new Schedule();
				setVisible(false);
				sched.setVisible(true);
				
				
			}
		});
		
		Icon acctIcon = new ImageIcon("C:\\Users\\Owner\\Documents\\CS3733\\Workspace\\HCI\\src\\accountsicon.gif");
		JButton btnAccounts = new JButton("Accounts");
		btnAccounts.setIcon(acctIcon);
		btnAccounts.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				
				acct = new Accounts();
				setVisible(false);
				acct.setVisible(true);
			}
		});
		btnAccounts.setFont(new Font("Tahoma", Font.PLAIN, 16));
		
		JButton btnPayroll = new JButton("PayRoll");
		btnPayroll.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				
				pr = new PayRoll();
				setVisible(false);
				pr.setVisible(true);
			}
		});
		btnPayroll.setFont(new Font("Tahoma", Font.PLAIN, 16));
		
		JButton btnBilling = new JButton("Billing");
		btnBilling.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				
				bill = new Billing();
				setVisible(false);
				bill.setVisible(true);
			}
		});
		btnBilling.setFont(new Font("Tahoma", Font.PLAIN, 16));
		
		JButton btnGps = new JButton("GPS");
		btnGps.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				
				gps = new GPS();
				setVisible(false);
				gps.setVisible(true);
			}
		});
		btnGps.setFont(new Font("Tahoma", Font.PLAIN, 16));
		
		JButton btnInventory = new JButton("Inventory");
		btnInventory.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				
				inv = new Inventory();
				setVisible(false);
				inv.setVisible(true);
			}
		});
		btnInventory.setFont(new Font("Tahoma", Font.PLAIN, 16));
		
		JButton btnRequests = new JButton("Requests");
		btnRequests.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				
				rqst = new Requests();
				setVisible(false);
				rqst.setVisible(true);
			}
		});
		btnRequests.setFont(new Font("Tahoma", Font.PLAIN, 16));
		
		JButton btnAddUser = new JButton("Add User");
		btnAddUser.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				
				au = new AddUser();
				setVisible(false);
				au.setVisible(true);
			}
		});
		btnAddUser.setFont(new Font("Tahoma", Font.PLAIN, 16));
		GroupLayout gl_contentPane = new GroupLayout(contentPane);
		gl_contentPane.setHorizontalGroup(
			gl_contentPane.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_contentPane.createSequentialGroup()
					.addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING)
						.addGroup(Alignment.LEADING, gl_contentPane.createSequentialGroup()
							.addGap(286)
							.addComponent(lblMainMenu, GroupLayout.PREFERRED_SIZE, 178, GroupLayout.PREFERRED_SIZE))
						.addGroup(Alignment.LEADING, gl_contentPane.createSequentialGroup()
							.addGap(79)
							.addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING, false)
								.addComponent(btnInventory, 0, 0, Short.MAX_VALUE)
								.addComponent(btnAccounts, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
							.addGap(70)
							.addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING, false)
								.addComponent(btnGps, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
								.addComponent(btnSchedule, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
					.addPreferredGap(ComponentPlacement.RELATED)
					.addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING, false)
						.addComponent(btnBilling, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
						.addComponent(btnRequests, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
					.addGap(21)
					.addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
						.addGroup(gl_contentPane.createSequentialGroup()
							.addPreferredGap(ComponentPlacement.RELATED, 1, Short.MAX_VALUE)
							.addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
								.addComponent(label)
								.addComponent(btnLogOut, Alignment.TRAILING))
							.addGap(46))
						.addGroup(gl_contentPane.createSequentialGroup()
							.addGap(72)
							.addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING, false)
								.addComponent(btnPayroll, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
								.addComponent(btnAddUser, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
							.addContainerGap())))
		);
		gl_contentPane.setVerticalGroup(
			gl_contentPane.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_contentPane.createSequentialGroup()
					.addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
						.addGroup(gl_contentPane.createSequentialGroup()
							.addComponent(label)
							.addGap(11)
							.addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING)
								.addGroup(gl_contentPane.createSequentialGroup()
									.addComponent(btnLogOut)
									.addGap(108))
								.addGroup(gl_contentPane.createSequentialGroup()
									.addGap(102)
									.addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE)
										.addComponent(btnAccounts)
										.addComponent(btnSchedule, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
										.addComponent(btnPayroll)
										.addComponent(btnBilling))))
							.addGap(99)
							.addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE)
								.addComponent(btnInventory, GroupLayout.PREFERRED_SIZE, 29, GroupLayout.PREFERRED_SIZE)
								.addComponent(btnGps, GroupLayout.PREFERRED_SIZE, 29, GroupLayout.PREFERRED_SIZE)
								.addComponent(btnAddUser)
								.addComponent(btnRequests)))
						.addComponent(lblMainMenu))
					.addGap(193))
		);
		contentPane.setLayout(gl_contentPane);
	}
}
